package com.onpositive.wiki3.db.impl;

import java.io.File;
import java.io.PrintStream;
import java.util.HashSet;

import com.onpositive.wiki3.catmodels.ClassificatorCategoryModel;
import com.onpositive.wiki3.catmodels.DateBasedSpecialisationCategoryModel;
import com.onpositive.wiki3.catmodels.ICategoryModel;
import com.onpositive.wiki3.catmodels.PluralCatModel;
import com.onpositive.wiki3.catmodels.PureLocationModel;
import com.onpositive.wiki3.catmodels.PuredDateCategoryModel;
import com.onpositive.wiki3.catmodels.SimpleSpecialisationCategoryModel;
import com.onpositive.wiki3.catmodels.SystemCategoryModel;
import com.onpositive.wiki3.catmodels.VerbCatModel;
import com.onpositive.wiki3.db.catmodel.Categories;
import com.onpositive.wiki3.db.catmodel.Category;
import com.onpositive.wiki3.db.catmodel.matches.classify.RelationStore;

import edu.smu.tspell.wordnet.Synset;
import edu.smu.tspell.wordnet.WordNetDatabase;

public class Test7 {

	public static void main(String[] args) {
		final WikiDBImpl wikiDBImpl = new WikiDBImpl("C:/work/content");
		try {
			RelationStore ss = new RelationStore(wikiDBImpl);
			System.setProperty("wordnet.database.dir", "C:/work/wn/dict");
			final Categories c = new Categories(wikiDBImpl, new File(
					"C:/work/content/n2.cats"), false);
			int a=0;
			int i=0;
			Synset[] synsets = WordNetDatabase.getFileInstance().getSynsets("gambling");
			System.out.println(synsets);
			HashSet<ICategoryModel>models=new HashSet<ICategoryModel>();
			models.add(new SystemCategoryModel());
			models.add(new ClassificatorCategoryModel());
			models.add(new PureLocationModel());
			models.add(new DateBasedSpecialisationCategoryModel());
			SimpleSpecialisationCategoryModel e = new SimpleSpecialisationCategoryModel();
			models.add(e);
			models.add(new PuredDateCategoryModel());			
			models.add(new VerbCatModel());
			models.add(new PluralCatModel());	
			
			PrintStream lot=new PrintStream(wikiDBImpl.getPath()+"/log.txt");
			l2:for (Category cc:c){
				i++;
				if (i%1000==0){
					System.out.println(i+":"+a);
				}
				for (ICategoryModel m:models){
					if (m.score(cc)!=0){
						a++;
						//System.out.println(m.getClass().getSimpleName());
						continue l2;
					}
				}
				lot.println(cc);				
			}
			System.out.println(a);
			System.out.println(c.size());
			//m.accept(c.get("bird_hunting"));
			//c.accept(m);
			System.out.println(ss.itemCount());
			ss.save();
		} catch (Exception e) {
			e.printStackTrace();
			// TODO: handle exception
		}
	}
}
